<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>订单查询</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'/>
    <%@include file="/WEB-INF/pages/common/taglib.jsp" %>
    <%@include file="/WEB-INF/pages/common/common.jsp" %>
</head>
<body class='contrast-red'>
<div class="content content_frame">
    <h3 class="mainTitle"><img src="${basePath}/images/icon2.png"/>订单查询</h3>
    </br>
    <ul class="contentNav dib-wrap">
        <li class="dib" id="btnSearch" defaultkey='13' onclick="$._options._query('corptable','queryOrderList')">
            <a><i class='fa fa-search'></i>&nbsp;&nbsp;查&nbsp;询 </a>
        </li>
        <li class="dib ">
            <a onclick="ClearAllInput('SearchTable')">
                <i class='fa fa-refresh'></i>&nbsp;&nbsp;重&nbsp;置 </a>
        </li>
    </ul>
    <br/>
    <table id="SearchTable" width="100%" class="table1">
        <tr>
            <td style="width: 50%;">
                <table width="100%" border="0" cellspacing="10" cellpadding="0">
                    <tr>
                        <td style="width: 50%;">
                            <table width="100%" border="0" cellspacing="10" cellpadding="0">
                                <tr>
                                    <td class="titleCss">
                                        订单编号
                                    </td>
                                    <td class="tdCss">
                                        <input type="text" datafield="SearchTable.orderId"/>
                                    </td>

                                </tr>
                            </table>
                        </td>
                        <td style="width: 50%;">
                            <table width="100%" border="0" cellspacing="10" cellpadding="0">
                                <tr>
                                    <td class="titleCss">
                                        贸易方式
                                    </td>
                                    <td class="tdCss">
                                        <ui:tsingletableautocomplete
                                                keyFieldName="tradeMode"
                                                valueFieldName="tradeModeXXXX"
                                                tableName="DICT_ITEM"
                                                key="ITEM_KEY"
                                                value="ITEM_VALUE"
                                                groupId="TRADE_MODE_QDC"/>
                                    </td>

                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 50%;">
                            <table width="100%" border="0" cellspacing="10" cellpadding="0">
                                <tr>
                                    <td class="titleCss">
                                        商户名称
                                    </td>
                                    <td class="tdCss">
                                        <input type="text" datafield="SearchTable.ebName"/>
                                    </td>

                                </tr>
                            </table>
                        </td>
                        <td style="width: 50%;">
                            <table width="100%" border="0" cellspacing="10" cellpadding="0">
                                <tr>
                                    <td class="titleCss">
                                        买方名称
                                    </td>
                                    <td class="tdCss">
                                        <input type="text" datafield="SearchTable.buyerName"/>
                                    </td>

                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 50%;">
                            <table width="100%" border="0" cellspacing="10" cellpadding="0">
                                <tr>
                                    <td class="titleCss">
                                        进出口类型
                                    </td>
                                    <td class="tdCss">
                                        <ui:tsingletableautocomplete
                                                keyFieldName="ieFlag"
                                                valueFieldName="ieFlagXXXX"
                                                tableName="DICT_ITEM"
                                                key="ITEM_KEY"
                                                value="ITEM_VALUE"
                                                groupId="ieType"/>
                                    </td>

                                </tr>
                            </table>
                        </td>
                        <td style="width: 50%;">
                            <table width="100%" border="0" cellspacing="10" cellpadding="0">
                                <tr>
                                    <td class="titleCss">
                                        操作状态
                                    </td>
                                    <td class="tdCss">
                                        <ui:tsingletableautocomplete
                                                key="ITEM_KEY"
                                                value="ITEM_VALUE"
                                                tableName="DICT_ITEM"
                                                groupId="ORDER_STATUS_QDC"
                                                keyFieldName="status"
                                                valueFieldName="statusXXX"/>
                                    </td>

                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 50%;">
                            <table width="100%" border="0" cellspacing="10" cellpadding="0">
                                <tr>
                                    <td class="titleCss">
                                        入库日期
                                    </td>
                                    <td class="tdCss">
                                        <input type="text" datafield="SearchTable.createTimeStart"
                                               id="createTimeStart"
                                               value="${orderHead.createTime}"
                                               class="Wdate"
                                               onclick="WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'#F{$dp.$D(\'createTimeEnd\')}'})">
                                    </td>

                                </tr>
                            </table>
                        </td>
                        <td style="width: 50%;">
                            <table width="100%" border="0" cellspacing="10" cellpadding="0">
                                <tr>
                                    <td class="titleCss">
                                        至
                                    </td>
                                    <td class="tdCss">
                                        <input type="text" datafield="SearchTable.createTimeEnd"
                                               id="createTimeEnd"
                                               value="${orderHead.createTime}"
                                               class="Wdate"
                                               onclick="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'createTimeStart\')}'})">
                                    </td>

                                </tr>
                            </table>
                        </td>
                    </tr>

                </table>
            </td>
        </tr>
    </table>
    <div class="cl"></div>
    <br/>
    <table id="corptable">
    </table>
    <div id="corptablePage">
    </div>
</div>

<script type="text/javascript">
    function detail(cellvalue, options, rowObject) {
        return $._options._detail($basePath + '/commonDetail/orderBillDetail?id=' + rowObject['id'],
                $.trim(cellvalue || ''));
    }

    function ieFlag(cellvalue, options, rowObject) {
        return $._options._dictName($.trim(cellvalue || ''), {"I": "进口", "E": "出口"});
    }

    $(function () {
        $("#corptable").jqGrid({
            datatype: "json",
            url: "queryOrderList",
            colNames: ['id', '订单编号', '进出口类型', '贸易方式', '商户代码', '商户名称', '商品总价', '币制', '买方名称', '买方证件类型', '买方证件号', '贸易国别', '买方电话', '收货地址', '电商平台代码', '备注', '入库日期', '操作状态'],
            colModel: [{name: 'id', index: 'id', key: true, hidden: true}, {
                name: 'orderId', index: 'orderId', formatter: detail
            }, {name: 'ieFlag', index: 'ieFlag', formatter: ieFlag}, {
                name: 'tradeModeDisplay', index: 'tradeModeDisplay'
            }, {name: 'ebCode', index: 'ebCode'}, {name: 'ebName', index: 'ebName'}, {
                name: 'totalPayment', index: 'totalPayment'
            }, {name: 'currDisplay', index: 'currDisplay'}, {
                name: 'buyerName', index: 'buyerName'
            }, {name: 'buyerCertTypeDisplay', index: 'buyerCertTypeDisplay'}, {
                name: 'buyerCertId', index: 'buyerCertId'
            }, {name: 'buyerCountryDisplay', index: 'buyerCountryDisplay'}, {
                name: 'buyerTel', index: 'buyerTel'
            }, {name: 'deliveryAddr', index: 'deliveryAddr'}, {name: 'ebPlatId', index: 'ebPlatId'}, {
                name: 'note', index: 'note'
            }, {name: 'createTime', index: 'createTime'}, {name: 'statusDisplay', index: 'statusDisplay'}],
            viewrecords: true, // show the current page, data rang and total records on the toolbar
            autowidth: true,
            height: 'auto',
            shrinkToFit: false,
            autoScroll: true,
            rowNum: 10, //每页显示记录数
            rowList: [10, 20, 100], //可调整每页显示的记录数
            rownumbers: true,
            rownumWidth: 35,
            width: $('body').width(),
            pager: "#corptablePage", //分页工具栏
            sortname: "createTime",
            sortorder: "desc",
            loadComplete: function () {
                var rowNum = $(this).jqGrid('getGridParam', 'records');
                if (rowNum <= 0) {
                    if ($(this).parent().children('.norecords').length == 0)
                        $(this).parent().append("<div class=\"norecords\">暂无数据！</div>");
                    $(this).parent().children('.norecords').show();
                } else {//如果存在记录，则隐藏提示信息。
                    $(this).parent().children('.norecords').hide();
                }
                $("#corptable").setGridWidth($(window).width()* 0.98);
                $(".ui-jqgrid tr.ui-row-ltr td").css('text-align', 'center');
            }
        });
    });
</script>
</body>
</html>
